    function checkEmail(){
        var email = $("#email").val();
       $.ajax({
          url: "/user/check_email",
          dataType: "html",
          data:{"email":email,'app_key':"<?php echo md5(time().time());?>"},
          type:"POST",
          success:function(data){
            if(data!='ok'){
                $("#error_img").show();
                $("#error").html('email已经注册.');
            }else{
                $("#img_ok").show();
                $("#error").html('');
            }
          },error:function(){
              alert('error');
          }
       });
    }

    function clearValue(id,value) {
        if($("#"+id).val() == value){
            $("#"+id).val('');
        }
        if($("#"+id).val() == 'email已经注册.'){
            $("#"+id).val('');
        }
    }
    function showDiv(){
       if(login != ''){
            return ;
        }
        document.getElementById('popDiv').style.display='block';
        document.getElementById('bg').style.display='block';
    }

    function closeDiv(){
        document.getElementById('popDiv').style.display='none';
        document.getElementById('bg').style.display='none';
    }

    function closeMe(){
        document.getElementById('list').style.display='block';
        document.getElementById('sign').style.display='none';
    }
    function showMe(){
        if(login != ''){
            return ;
        }
        document.getElementById('sign').style.display='block';
        document.getElementById('list').style.display='none';
    }
    function login_in(){
        var email   = $("#login_email").val();
        var password   = $("#login_password").val();
        if(email == '' || password == ''){
            alert('缺少邮箱或密码');
            return ;
        }
       $.ajax({
              url: "/user/login/",
              dataType: "html",
              data:{"email":email,'password':password},
              type:"POST",
              success:function(data){
                if(data == 'ok'){
                    closeDiv();
                    loged();
                }else{
                    alert('帐号或密码错误');
                }
              }
        });
    }


    function join_us() {
        check_pass();
        if(post ==false) {
            return ;
        }
        var email   = $("#email").val();
        var pass   = $("#password1").val();
        $.ajax({
              url: "/user/join_us/",
              dataType: "html",
              data:{"email":email,'password':pass},
              type:"POST",
              success:function(data){
                if(data == 'ok'){
                    location.href   = '/user';
                }else{
                    alert('注册失败');
                }
              }
        });
    }
    
    function join_email() {
        check_pass();
        if(post ==false) {
            return ;
        }
        var email   = $("#email").val();
        var pass   = $("#password1").val();
        $.ajax({
              url: "/home/reset_password/",
              dataType: "html",
              data:{"email":email,'password':pass},
              type:"POST",
              success:function(data){
                if(data == 'ok'){
                    location.href   = '/user';
                }else{
                    alert('注册失败');
                }
              }
        });
    }

    function check_pass(){
        var pass1   = $("#password1").val();
        var pass2   = $("#password2").val();
        if(pass1 != pass2){
            $("#pass2_error").show();
        }else{
            $("#pass2_error").hide();
            $("#pass2_ok").show();
        }
    }

    function showAjax() {
        $("#show_notice").show();
        $("#show_notice").height(150);
    }

    function hideAjax() {
        $("#show_notice").hide();
    }


    function tencentUrl(id) {
        $.ajax({
            url : front + '/tencent_url/',
            data: {'uhash':id},
            type: "POST",
            dataType:"json",
            success:function(re) {
                if(re.code == 'ok') {
                    tencentUrlHtml(id,re.msg);
                }else{
                    alert(re.msg);
                }
            },error:function(){
                
            }
        });
    }

    function tencentUrlHtml(id,hash) {
        var str = '';
        var clip_sina;
            str+='腾讯短连接：<input type="hidden" id="qq_copy_'+id+'" value="http://url.cn/'+hash+'">';
            str+='url.cn/'+hash+'<span id="qq_copy_button_'+id+'" class="copy">复制</span>';
            $("#tencent_"+id).html(str);
            
            clip_sina = new ZeroClipboard.Client();
            clip_sina.setHandCursor( true );
            clip_sina.glue('qq_copy_button_'+id);
            clip_sina.setText( $('#qq_copy_'+id).val());
            //clip_sina   = null;
            clip_sina.addEventListener( "complete", function(){
                alert("复制成功！");
            });
    }

    function sinaUrl(id) {
       $.ajax({
            url : front + '/sina_url/',
            data: {'uhash':id},
            type: "POST",
            dataType:"json",
            success:function(re) {
                if(re.code == 'ok') {
                    sinaUrlHtml(id,re.msg);
                }else{
                    alert(re.msg);
                }
            },error:function(){

            }
        });
    }


    function sinaUrlHtml(id,hash) {
        var str = '';
        var clip_sina;
            str+='新浪短连接：<input type="hidden" id="sina_copy_'+id+'" value="http://t.cn/'+hash+'">';
            str+='t.cn/'+hash+'<span id="sina_copy_button_'+id+'" class="copy">复制</span>';
            $("#sina_"+id).html(str);

            clip_sina = new ZeroClipboard.Client();
            clip_sina.setHandCursor( true );
            clip_sina.glue('sina_copy_button_'+id);
            clip_sina.setText( $('#sina_copy_'+id).val());
            //clip_sina   = null;
            clip_sina.addEventListener( "complete", function(){
                alert("复制成功！");
            });
    }